package com.xjj.attend;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.concurrent.TimeUnit;

/**
 * @Auther: AYang
 * @Date: 2022/10/26 16:53
 * @Description:
 */
@SpringBootTest
public class AttendService {
    @Test
    public int getSecondNumber() {
        LocalTime midnight = LocalTime.MIDNIGHT;
        LocalDate today = LocalDate.now();
        LocalDateTime todayMidnight = LocalDateTime.of( today, midnight );
        LocalDateTime tomorrowMidnight = todayMidnight.plusDays( 1 );
        long seconds = TimeUnit.NANOSECONDS.toSeconds( Duration.between( LocalDateTime.now(), tomorrowMidnight ).toNanos() );
        return (int) seconds;
    }

    @Test
    public void timeTest(){
        System.out.println(getSecondNumber());
    }

}
